
//
// 130423 - AH - Created.
//

package org.japril.jutil.xmloperations;

import java.io.IOException;

/**
 * <p>
 *   Interface for objects that performs an operation as function of some XML
 *   given has some XPath paths.
 * </p>
 * <p>
 *   Iterable over XPath's 
 *   {@code String} representations.
 * </p>
 * @author Arne Halvorsen (AH)
 */
public interface XmlOperation 
{
  /**
   * <p>
   *   Gets name of operation.
   * </p>
   * @return Name.
   */
  String getName();
  
  /**
   * <p>
   *   Gets operation's description.
   * </p>
   * @return Description or {@code null} if has non.
   */
  String getDesc();
  
  /**
   * <p>
   *   Gets number of paths {@code this} has.
   * </p>
   * @return Count.
   */
  int getPathCount();
  
  /**
   * <p>
   *   Gets path.
   * </p>
   * @param idx Index of path.
   * @return Path.
   * @throws IndexOutOfBoundsException If {@code udx<0 || idx>=getPath()}. 
   */
  String getPath(int idx);
  
  /**
   * <p>
   *   Performs operation.
   * </p>
   * @param xml XML to perform on.
   * @throws IOException If fails.
   */
  void perform(String xml) throws IOException;
  
}
